From 6e5a27a29d33d50a2a4380c406405435d919b6b4 Mon Sep 17 00:00:00 2001 From: Etienne Champetier Date: Mon, 18 Aug 2025 17:41:37 -0400 Subject: [PATCH] deploy: call syncfs() for /ostree instead of / In full_system_sync we were calling syncfs(/) expecting all the recent modification in /ostree to be synced to disk. With / now being composefs, syncfs(/) is a noop, so call syncfs(/ostree) as that is what we really want. --- src/libostree/ostree-sysroot-deploy.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c index 6cb6dd53..4abd7001 100644 --- a/src/libostree/ostree-sysroot-deploy.c +++ b/src/libostree/ostree-sysroot-deploy.c @@ -1634,21 +1634,22 @@ typedef struct guint64 boot_syncfs_msec; } SyncStats; -/* First, sync the root directory as well as /var and /boot which may - * be separate mount points. Then *in addition*, do a global - * `sync()`. +/* sync /ostree and /boot which may be separate mount points. */ static gboolean full_system_sync (OstreeSysroot *self, SyncStats *out_stats, GCancellable *cancellable, GError **error) { GLNX_AUTO_PREFIX_ERROR ("Full sync", error); - ot_journal_print (LOG_INFO, "Starting syncfs() for system root"); + ot_journal_print (LOG_INFO, "Starting syncfs() for /ostree"); guint64 start_msec = g_get_monotonic_time () / 1000; - if (syncfs (self->sysroot_fd) != 0) - return glnx_throw_errno_prefix (error, "syncfs(sysroot)"); + glnx_autofd int ostree_dfd = -1; + if (!glnx_opendirat (self->sysroot_fd, "ostree", TRUE, &ostree_dfd, error)) + return glnx_throw_errno_prefix (error, "glnx_opendirat(/ostree)"); + if (syncfs (ostree_dfd) != 0) + return glnx_throw_errno_prefix (error, "syncfs(/ostree)"); guint64 end_msec = g_get_monotonic_time () / 1000; - ot_journal_print (LOG_INFO, "Completed syncfs() for system root in %" G_GUINT64_FORMAT " ms", + ot_journal_print (LOG_INFO, "Completed syncfs() for /ostree in %" G_GUINT64_FORMAT " ms", end_msec - start_msec); out_stats->root_syncfs_msec = (end_msec - start_msec); -- 2.30.2